home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / psizzl / index.psizzl (.txt) < prev    next >
LaTeX Document  |  1992-08-26  |  3KB  |  90 lines

  1. % INDEX PSIZZL - indexing macros for TeX version 1.0
  2. % index entries come in two visibilities - non-silent and silent
  3. % non-silent entries are preceeded by a ^
  4. % while silent entries are preceeded by ^^
  5. % the four types of non-silent entries are as follows
  6. % ^{text}   - type 0, normal
  7. % ^|text|   - type 1, TeX input, but not a control sequence
  8. % ^|\text|  - type 2, TeX control sequence
  9. % ^\<text>  - type 3, TeX concept, a mnemonic name
  10. % the format of the entry in the index file is:
  11. % text_!n_pp.  where _ is a space, n is the index type,
  12. %                    pp is the page number
  13. \newif\ifproofindex
  14. \let\numbercount=\relax
  15. \def\\{%
  16.    {\tt\char'134}%
  17.    }%
  18. \def\<{%
  19.    \relax\ifmmode\mskip\medmuskip\else\char'74\fi
  20.    }%
  21. \newwrite\@ndexwrite\def\@ndexfile{index.psiztemp }%
  22. \adddef\fmtreset{%
  23.    \immediate\openout\@ndexwrite=\@ndexfile % file for index reminders
  24.    }%
  25. \newif\ifsilent
  26. \def\specialhat{%
  27.    \relax\ifmmode\def\next{^}\else\let\next=\beginxref\fi\next
  28.    }%
  29. \def\beginxref{%
  30.    \futurelet\next\beginxrefswitch
  31.    }%
  32. \def\beginxrefswitch{%
  33.    \ifx\next\specialhat\let\next\silentxref
  34.       \else\silentfalse\let\next\xref
  35.       \fi
  36.    \next
  37.    }%
  38. {\c@tCactive\global\let^\specialhat\gdef\silentxref^{\silenttrue\xref}}%
  39. \c@tCactive\adddef\l@twrite\l@tCzero %this turns on indexing capability
  40. {\c@tVcontrol\c@tBactive|gdef\{}}% \ as an active character -> nothing
  41. \def\marginstyle{\vrule height6pt depth2pt width0pt \sevenrm}%
  42. \chardef\bslash=`\\
  43. \def\xref{%
  44.    \futurelet\next\xrefswitch
  45.    }%
  46. \def\xrefswitch{%
  47.    \begingroup
  48.       \ifx\next|%
  49.          \aftergroup\vxref % case 1 or 2, |arg| or |\arg|
  50.          \else
  51.          \ifx\next\<%
  52.             \aftergroup\anglexref % case 3, "\<arg>" means angle bracke
  53.             \else
  54.             \aftergroup\normalxref% case 0, "{arg}"
  55.             \fi
  56.          \fi
  57.       \endgroup
  58.    }%
  59. \def\vxref|{\c@tBactive\futurelet\next\vxrefswitch}%
  60. \def\vxrefswitch#1|{\c@tBcontrol
  61.    \ifx\next\empty
  62.       \def\xreftype{2}\def\next{{\tt\bslash\text}}% type 2, |\arg|
  63.       \else
  64.       \def\xreftype{1}\def\next{{\tt\text}}% type 1, |arg|
  65.       \fi
  66.    \edef\text{#1}\makexref
  67.    }%
  68. \def\anglexref\<#1>{%
  69.    \def\xreftype{3}\def\text{#1}\def\next{$\langle$\text$\rangle$}%
  70.    \makexref
  71.    }%
  72. \def\normalxref#1{%
  73.    \def\xreftype{0}\def\text{#1}\let\next=\text\makexref
  74.    }%
  75. \def\makexref{%
  76.    \ifproofindex
  77.       \insert\margin{\hbox{\marginstyle\text}}%
  78.       \xdef\writeit{%
  79.          \write\@ndexwrite{%
  80.             \text\space!\xreftype\space\noexpand\number\p@gecount.%
  81.             }%
  82.          }%
  83.       \writeit
  84.       \else\ifhmode\kern\z@\fi
  85.       \fi
  86.    \ifsilent\ignorespaces\else\next\fi
  87.    }%
  88. % the \insert (which is done in proofmode only) suppresses hyphenation,
  89. % so the \kern\z@ is put in to give the same effect in non-proofmode.
  90.